{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 小组赛分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>competition_time</th>\n",
       "      <th>净胜球</th>\n",
       "      <th>主客</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018-06-14 23:00:00</td>\n",
       "      <td>0.824845</td>\n",
       "      <td>俄罗斯,沙特阿拉伯</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2018-06-15 20:00:00</td>\n",
       "      <td>-0.275923</td>\n",
       "      <td>埃及,乌拉圭</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2018-06-20 02:00:00</td>\n",
       "      <td>0.299574</td>\n",
       "      <td>俄罗斯,埃及</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2018-06-20 23:00:00</td>\n",
       "      <td>0.498543</td>\n",
       "      <td>乌拉圭,沙特阿拉伯</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2018-06-25 22:00:00</td>\n",
       "      <td>-0.141609</td>\n",
       "      <td>沙特阿拉伯,埃及</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     competition_time       净胜球         主客\n",
       "0 2018-06-14 23:00:00  0.824845  俄罗斯,沙特阿拉伯\n",
       "1 2018-06-15 20:00:00 -0.275923     埃及,乌拉圭\n",
       "2 2018-06-20 02:00:00  0.299574     俄罗斯,埃及\n",
       "3 2018-06-20 23:00:00  0.498543  乌拉圭,沙特阿拉伯\n",
       "4 2018-06-25 22:00:00 -0.141609   沙特阿拉伯,埃及"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "result_pro = pd.read_csv(r\"D:\\worldcup\\result.csv\", encoding='gbk')\n",
    "result_pro['competition_time'] = pd.to_datetime(result_pro['competition_time'])\n",
    "result_pro['主客'] = result_pro['team1'].str.cat(result_pro['team2'], sep=',')\n",
    "result_pro = result_pro.drop(['team1','team2'], axis=1).reset_index(drop=True)\n",
    "result_pro.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>赛事</th>\n",
       "      <th>时间</th>\n",
       "      <th>主队</th>\n",
       "      <th>主</th>\n",
       "      <th>和</th>\n",
       "      <th>客</th>\n",
       "      <th>客队</th>\n",
       "      <th>比分</th>\n",
       "      <th>真实净胜球</th>\n",
       "      <th>主客</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-29 02:00:00</td>\n",
       "      <td>英格兰</td>\n",
       "      <td>2.551</td>\n",
       "      <td>2.936</td>\n",
       "      <td>3.273</td>\n",
       "      <td>比利时</td>\n",
       "      <td>0:01</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>英格兰,比利时</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-29 02:00:00</td>\n",
       "      <td>巴拿马</td>\n",
       "      <td>4.170</td>\n",
       "      <td>3.577</td>\n",
       "      <td>1.923</td>\n",
       "      <td>突尼斯</td>\n",
       "      <td>1:02</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>巴拿马,突尼斯</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-28 22:00:00</td>\n",
       "      <td>塞内加尔</td>\n",
       "      <td>4.710</td>\n",
       "      <td>3.607</td>\n",
       "      <td>1.809</td>\n",
       "      <td>哥伦比亚</td>\n",
       "      <td>0:01</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>塞内加尔,哥伦比亚</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-28 22:00:00</td>\n",
       "      <td>日本</td>\n",
       "      <td>3.062</td>\n",
       "      <td>3.165</td>\n",
       "      <td>2.577</td>\n",
       "      <td>波兰</td>\n",
       "      <td>0:01</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>日本,波兰</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-28 02:00:00</td>\n",
       "      <td>瑞士</td>\n",
       "      <td>1.629</td>\n",
       "      <td>3.597</td>\n",
       "      <td>6.872</td>\n",
       "      <td>哥斯达黎加</td>\n",
       "      <td>2:02</td>\n",
       "      <td>0.0</td>\n",
       "      <td>瑞士,哥斯达黎加</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     赛事                  时间    主队      主      和      客     客队    比分  真实净胜球  \\\n",
       "0  世界杯分 2018-06-29 02:00:00   英格兰  2.551  2.936  3.273    比利时  0:01   -1.0   \n",
       "1  世界杯分 2018-06-29 02:00:00   巴拿马  4.170  3.577  1.923    突尼斯  1:02   -1.0   \n",
       "2  世界杯分 2018-06-28 22:00:00  塞内加尔  4.710  3.607  1.809   哥伦比亚  0:01   -1.0   \n",
       "3  世界杯分 2018-06-28 22:00:00    日本  3.062  3.165  2.577     波兰  0:01   -1.0   \n",
       "4  世界杯分 2018-06-28 02:00:00    瑞士  1.629  3.597  6.872  哥斯达黎加  2:02    0.0   \n",
       "\n",
       "          主客  \n",
       "0    英格兰,比利时  \n",
       "1    巴拿马,突尼斯  \n",
       "2  塞内加尔,哥伦比亚  \n",
       "3      日本,波兰  \n",
       "4   瑞士,哥斯达黎加  "
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import re\n",
    "\n",
    "result_group = pd.read_csv(r\"D:\\worldcup\\world_cup_group.csv\", encoding='gbk')\n",
    "result_group['时间'] = pd.to_datetime(result_group['时间'])\n",
    "result_group['主'] = [float(re.search(r'^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$', x).group()) for x in result_group['主']]\n",
    "result_group['和'] = [float(re.search(r'^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$', x).group()) for x in result_group['和']]\n",
    "result_group['客'] = [float(re.search(r'^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$', x).group()) for x in result_group['客']]\n",
    "result_group['真实净胜球'] = [float(x.split(':')[0])-float(x.split(':')[1]) for x in result_group['比分']]\n",
    "result_group['主客'] = result_group['主队'].str.cat(result_group['客队'], sep=',')\n",
    "result_group.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>competition_time</th>\n",
       "      <th>净胜球</th>\n",
       "      <th>主客</th>\n",
       "      <th>赛事</th>\n",
       "      <th>时间</th>\n",
       "      <th>主队</th>\n",
       "      <th>主</th>\n",
       "      <th>和</th>\n",
       "      <th>客</th>\n",
       "      <th>客队</th>\n",
       "      <th>比分</th>\n",
       "      <th>真实净胜球</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018-06-14 23:00:00</td>\n",
       "      <td>0.824845</td>\n",
       "      <td>俄罗斯,沙特阿拉伯</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-14 23:00:00</td>\n",
       "      <td>俄罗斯</td>\n",
       "      <td>1.421</td>\n",
       "      <td>4.331</td>\n",
       "      <td>9.181</td>\n",
       "      <td>沙特阿拉伯</td>\n",
       "      <td>5:00</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2018-06-15 20:00:00</td>\n",
       "      <td>-0.275923</td>\n",
       "      <td>埃及,乌拉圭</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-15 20:00:00</td>\n",
       "      <td>埃及</td>\n",
       "      <td>6.833</td>\n",
       "      <td>3.776</td>\n",
       "      <td>1.578</td>\n",
       "      <td>乌拉圭</td>\n",
       "      <td>0:01</td>\n",
       "      <td>-1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2018-06-20 02:00:00</td>\n",
       "      <td>0.299574</td>\n",
       "      <td>俄罗斯,埃及</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-20 02:00:00</td>\n",
       "      <td>俄罗斯</td>\n",
       "      <td>1.959</td>\n",
       "      <td>3.357</td>\n",
       "      <td>4.242</td>\n",
       "      <td>埃及</td>\n",
       "      <td>3:01</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2018-06-20 23:00:00</td>\n",
       "      <td>0.498543</td>\n",
       "      <td>乌拉圭,沙特阿拉伯</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-20 23:00:00</td>\n",
       "      <td>乌拉圭</td>\n",
       "      <td>1.210</td>\n",
       "      <td>6.435</td>\n",
       "      <td>16.375</td>\n",
       "      <td>沙特阿拉伯</td>\n",
       "      <td>1:00</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2018-06-25 22:00:00</td>\n",
       "      <td>-0.141609</td>\n",
       "      <td>沙特阿拉伯,埃及</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-25 22:00:00</td>\n",
       "      <td>沙特阿拉伯</td>\n",
       "      <td>4.989</td>\n",
       "      <td>3.550</td>\n",
       "      <td>1.782</td>\n",
       "      <td>埃及</td>\n",
       "      <td>2:01</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     competition_time       净胜球         主客    赛事                  时间     主队  \\\n",
       "0 2018-06-14 23:00:00  0.824845  俄罗斯,沙特阿拉伯  世界杯分 2018-06-14 23:00:00    俄罗斯   \n",
       "1 2018-06-15 20:00:00 -0.275923     埃及,乌拉圭  世界杯分 2018-06-15 20:00:00     埃及   \n",
       "2 2018-06-20 02:00:00  0.299574     俄罗斯,埃及  世界杯分 2018-06-20 02:00:00    俄罗斯   \n",
       "3 2018-06-20 23:00:00  0.498543  乌拉圭,沙特阿拉伯  世界杯分 2018-06-20 23:00:00    乌拉圭   \n",
       "4 2018-06-25 22:00:00 -0.141609   沙特阿拉伯,埃及  世界杯分 2018-06-25 22:00:00  沙特阿拉伯   \n",
       "\n",
       "       主      和       客     客队    比分  真实净胜球  \n",
       "0  1.421  4.331   9.181  沙特阿拉伯  5:00    5.0  \n",
       "1  6.833  3.776   1.578    乌拉圭  0:01   -1.0  \n",
       "2  1.959  3.357   4.242     埃及  3:01    2.0  \n",
       "3  1.210  6.435  16.375  沙特阿拉伯  1:00    1.0  \n",
       "4  4.989  3.550   1.782     埃及  2:01    1.0  "
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result_all = pd.merge(result_pro, result_group, on = '主客')\n",
    "result_all.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "相关系数： [[ 1.          0.51829478]\n",
      " [ 0.51829478  1.        ]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAEICAYAAABfz4NwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xt4XHd56PvvOzfN6D6Kr4klyypJ\nDQm52JILu2BMSChtOSmlcEg3FFpK47IpJz0tfYACOW1KW/ZpH/YT2gN1KDztoecQStpCWjYbCGDc\ndgdsmcQJOZiY2rIlx45sa2Rd5r7mPX+sNWPdNbrMrJnR+3kePZJnltZ613i03lm/y/sTVcUYY4wJ\n+B2AMcaY2mAJwRhjDGAJwRhjjMcSgjHGGMASgjHGGI8lBGOMMYAlBGOMMR5LCMYYYwBLCMYYYzwh\nvwNYiU2bNmlvb6/fYRhj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qnp5vWI0Zr1Y\nQjDGGAPYPARjjDEeSwjGGGMASwjGGGM8lhCMMcYAlhCMMcZ4/n+d8WSfRR1hWwAAAABJRU5ErkJg\ngg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xd1c8a90>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import numpy as np\n",
    "%matplotlib inline\n",
    "\n",
    "plt.rcParams['font.sans-serif']=['SimHei']\n",
    "sns.regplot(x=\"净胜球\", y=\"真实净胜球\", data=result_all)\n",
    "np.corrcoef(result_all.loc[:, [\"净胜球\", \"真实净胜球\"]],rowvar=0)\n",
    "print('相关系数：', np.corrcoef(result_all.loc[:, [\"净胜球\", \"真实净胜球\"]],rowvar=0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>competition_time</th>\n",
       "      <th>净胜球</th>\n",
       "      <th>主客</th>\n",
       "      <th>赛事</th>\n",
       "      <th>时间</th>\n",
       "      <th>主队</th>\n",
       "      <th>主</th>\n",
       "      <th>和</th>\n",
       "      <th>客</th>\n",
       "      <th>客队</th>\n",
       "      <th>比分</th>\n",
       "      <th>真实净胜球</th>\n",
       "      <th>money</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018-06-14 23:00:00</td>\n",
       "      <td>0.824845</td>\n",
       "      <td>俄罗斯,沙特阿拉伯</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-14 23:00:00</td>\n",
       "      <td>俄罗斯</td>\n",
       "      <td>1.421</td>\n",
       "      <td>4.331</td>\n",
       "      <td>9.181</td>\n",
       "      <td>沙特阿拉伯</td>\n",
       "      <td>5:00</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2018-06-15 20:00:00</td>\n",
       "      <td>-0.275923</td>\n",
       "      <td>埃及,乌拉圭</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-15 20:00:00</td>\n",
       "      <td>埃及</td>\n",
       "      <td>6.833</td>\n",
       "      <td>3.776</td>\n",
       "      <td>1.578</td>\n",
       "      <td>乌拉圭</td>\n",
       "      <td>0:01</td>\n",
       "      <td>-1.0</td>\n",
       "      <td>1.578</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2018-06-20 02:00:00</td>\n",
       "      <td>0.299574</td>\n",
       "      <td>俄罗斯,埃及</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-20 02:00:00</td>\n",
       "      <td>俄罗斯</td>\n",
       "      <td>1.959</td>\n",
       "      <td>3.357</td>\n",
       "      <td>4.242</td>\n",
       "      <td>埃及</td>\n",
       "      <td>3:01</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2018-06-20 23:00:00</td>\n",
       "      <td>0.498543</td>\n",
       "      <td>乌拉圭,沙特阿拉伯</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-20 23:00:00</td>\n",
       "      <td>乌拉圭</td>\n",
       "      <td>1.210</td>\n",
       "      <td>6.435</td>\n",
       "      <td>16.375</td>\n",
       "      <td>沙特阿拉伯</td>\n",
       "      <td>1:00</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.210</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2018-06-25 22:00:00</td>\n",
       "      <td>-0.141609</td>\n",
       "      <td>沙特阿拉伯,埃及</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>2018-06-25 22:00:00</td>\n",
       "      <td>沙特阿拉伯</td>\n",
       "      <td>4.989</td>\n",
       "      <td>3.550</td>\n",
       "      <td>1.782</td>\n",
       "      <td>埃及</td>\n",
       "      <td>2:01</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     competition_time       净胜球         主客    赛事                  时间     主队  \\\n",
       "0 2018-06-14 23:00:00  0.824845  俄罗斯,沙特阿拉伯  世界杯分 2018-06-14 23:00:00    俄罗斯   \n",
       "1 2018-06-15 20:00:00 -0.275923     埃及,乌拉圭  世界杯分 2018-06-15 20:00:00     埃及   \n",
       "2 2018-06-20 02:00:00  0.299574     俄罗斯,埃及  世界杯分 2018-06-20 02:00:00    俄罗斯   \n",
       "3 2018-06-20 23:00:00  0.498543  乌拉圭,沙特阿拉伯  世界杯分 2018-06-20 23:00:00    乌拉圭   \n",
       "4 2018-06-25 22:00:00 -0.141609   沙特阿拉伯,埃及  世界杯分 2018-06-25 22:00:00  沙特阿拉伯   \n",
       "\n",
       "       主      和       客     客队    比分  真实净胜球  money  \n",
       "0  1.421  4.331   9.181  沙特阿拉伯  5:00    5.0  1.421  \n",
       "1  6.833  3.776   1.578    乌拉圭  0:01   -1.0  1.578  \n",
       "2  1.959  3.357   4.242     埃及  3:01    2.0  1.959  \n",
       "3  1.210  6.435  16.375  沙特阿拉伯  1:00    1.0  1.210  \n",
       "4  4.989  3.550   1.782     埃及  2:01    1.0  0.000  "
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "for i in range(len(result_all)):\n",
    "    if result_all.loc[i, '净胜球'] > 0.1:\n",
    "        if result_all.loc[i, '真实净胜球'] > 0:\n",
    "            result_all.loc[i, 'money'] = result_all.loc[i, '主']\n",
    "    if result_all.loc[i, '净胜球'] < -0.1:\n",
    "        if result_all.loc[i, '真实净胜球'] < 0:\n",
    "            result_all.loc[i, 'money'] = result_all.loc[i, '客']\n",
    "    else:\n",
    "        if result_all.loc[i, '真实净胜球'] == 0:\n",
    "            result_all.loc[i, 'money'] = result_all.loc[i, '和']\n",
    "result_all = result_all.fillna(0)\n",
    "result_all.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "你能赚多少： 1.6328936170212762\n",
      "利率： 0.6328936170212762\n"
     ]
    }
   ],
   "source": [
    "rate = np.mean(result_all['money'])\n",
    "print('你能赚多少：',rate)\n",
    "print('利率：',(rate-1))\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 淘汰赛八强预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>team_id</th>\n",
       "      <th>team_name</th>\n",
       "      <th>home_team</th>\n",
       "      <th>visiting_team</th>\n",
       "      <th>type</th>\n",
       "      <th>time</th>\n",
       "      <th>result</th>\n",
       "      <th>foul</th>\n",
       "      <th>yellow_card</th>\n",
       "      <th>red_card</th>\n",
       "      <th>possession</th>\n",
       "      <th>shot</th>\n",
       "      <th>pass</th>\n",
       "      <th>pass_rate</th>\n",
       "      <th>most</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>665</th>\n",
       "      <td>10</td>\n",
       "      <td>法国</td>\n",
       "      <td>法国</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>国际友谊</td>\n",
       "      <td>2017/3/29 03:00:00</td>\n",
       "      <td>0-2</td>\n",
       "      <td>17</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0.41</td>\n",
       "      <td>8(2)</td>\n",
       "      <td>439(371)</td>\n",
       "      <td>0.85</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>699</th>\n",
       "      <td>10</td>\n",
       "      <td>法国</td>\n",
       "      <td>法国</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>国际友谊</td>\n",
       "      <td>2014/9/5 03:00:00</td>\n",
       "      <td>1-0</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.42</td>\n",
       "      <td>10(5)</td>\n",
       "      <td>0(0)</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>717</th>\n",
       "      <td>10</td>\n",
       "      <td>法国</td>\n",
       "      <td>法国</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>欧洲预选</td>\n",
       "      <td>2013/3/27 04:00:00</td>\n",
       "      <td>0-1</td>\n",
       "      <td>21</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0.24</td>\n",
       "      <td>15(3)</td>\n",
       "      <td>0(0)</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>721</th>\n",
       "      <td>10</td>\n",
       "      <td>法国</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>法国</td>\n",
       "      <td>欧洲预选</td>\n",
       "      <td>2012/10/17 03:00:00</td>\n",
       "      <td>1-1</td>\n",
       "      <td>10</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0.50</td>\n",
       "      <td>7(3)</td>\n",
       "      <td>0(0)</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>725</th>\n",
       "      <td>10</td>\n",
       "      <td>法国</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>法国</td>\n",
       "      <td>欧洲杯</td>\n",
       "      <td>2012/6/24 02:45:00</td>\n",
       "      <td>2-0</td>\n",
       "      <td>12</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0.45</td>\n",
       "      <td>4(1)</td>\n",
       "      <td>0(0)</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     team_id team_name home_team visiting_team  type                 time  \\\n",
       "665       10        法国        法国           西班牙  国际友谊   2017/3/29 03:00:00   \n",
       "699       10        法国        法国           西班牙  国际友谊    2014/9/5 03:00:00   \n",
       "717       10        法国        法国           西班牙  欧洲预选   2013/3/27 04:00:00   \n",
       "721       10        法国       西班牙            法国  欧洲预选  2012/10/17 03:00:00   \n",
       "725       10        法国       西班牙            法国   欧洲杯   2012/6/24 02:45:00   \n",
       "\n",
       "    result  foul  yellow_card  red_card  possession   shot      pass  \\\n",
       "665    0-2    17            2         0        0.41   8(2)  439(371)   \n",
       "699    1-0     9            0         0        0.42  10(5)      0(0)   \n",
       "717    0-1    21            3         1        0.24  15(3)      0(0)   \n",
       "721    1-1    10            2         2        0.50   7(3)      0(0)   \n",
       "725    2-0    12            2         1        0.45   4(1)      0(0)   \n",
       "\n",
       "     pass_rate  most  score  \n",
       "665       0.85     1      4  \n",
       "699       0.00     0      2  \n",
       "717       0.00     0      5  \n",
       "721       0.00     0      3  \n",
       "725       0.00     0      3  "
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "historical_record = pd.read_csv(r\"D:\\worldcup\\historical_record.csv\")\n",
    "del historical_record['id']\n",
    "del historical_record['create_time']\n",
    "del historical_record['update_time']\n",
    "historical_record = historical_record.drop_duplicates() \n",
    "historical_record.loc[(historical_record[\"team_name\"] == '法国') & ((historical_record[\"home_team\"] == '西班牙') | (historical_record[\"visiting_team\"] == '西班牙'))]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>foul</th>\n",
       "      <th>home_team</th>\n",
       "      <th>most</th>\n",
       "      <th>pass</th>\n",
       "      <th>pass_rate</th>\n",
       "      <th>possession</th>\n",
       "      <th>red_card</th>\n",
       "      <th>result</th>\n",
       "      <th>score</th>\n",
       "      <th>shot</th>\n",
       "      <th>team_id</th>\n",
       "      <th>team_name</th>\n",
       "      <th>time</th>\n",
       "      <th>type</th>\n",
       "      <th>visiting_team</th>\n",
       "      <th>yellow_card</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>英格兰</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>英格兰</td>\n",
       "      <td>2018-06-29 02:00:00</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>比利时</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>巴拿马</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1-02</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>巴拿马</td>\n",
       "      <td>2018-06-29 02:00:00</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>突尼斯</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>塞内加尔</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>塞内加尔</td>\n",
       "      <td>2018-06-28 22:00:00</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>哥伦比亚</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>日本</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0-01</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>日本</td>\n",
       "      <td>2018-06-28 22:00:00</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>波兰</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>NaN</td>\n",
       "      <td>瑞士</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2-02</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>瑞士</td>\n",
       "      <td>2018-06-28 02:00:00</td>\n",
       "      <td>世界杯分</td>\n",
       "      <td>哥斯达黎加</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   foul home_team  most pass  pass_rate  possession  red_card result  score  \\\n",
       "0   NaN       英格兰   NaN  NaN        NaN         NaN       NaN   0-01    NaN   \n",
       "1   NaN       巴拿马   NaN  NaN        NaN         NaN       NaN   1-02    NaN   \n",
       "2   NaN      塞内加尔   NaN  NaN        NaN         NaN       NaN   0-01    NaN   \n",
       "3   NaN        日本   NaN  NaN        NaN         NaN       NaN   0-01    NaN   \n",
       "4   NaN        瑞士   NaN  NaN        NaN         NaN       NaN   2-02    NaN   \n",
       "\n",
       "  shot  team_id team_name                 time  type visiting_team  \\\n",
       "0  NaN      NaN       英格兰  2018-06-29 02:00:00  世界杯分           比利时   \n",
       "1  NaN      NaN       巴拿马  2018-06-29 02:00:00  世界杯分           突尼斯   \n",
       "2  NaN      NaN      塞内加尔  2018-06-28 22:00:00  世界杯分          哥伦比亚   \n",
       "3  NaN      NaN        日本  2018-06-28 22:00:00  世界杯分            波兰   \n",
       "4  NaN      NaN        瑞士  2018-06-28 02:00:00  世界杯分         哥斯达黎加   \n",
       "\n",
       "   yellow_card  \n",
       "0          NaN  \n",
       "1          NaN  \n",
       "2          NaN  \n",
       "3          NaN  \n",
       "4          NaN  "
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "historical_group = result_group.rename(columns={'主队':'home_team', '客队':'visiting_team', '赛事':'type', '时间':'time', '比分':'result'}).loc[:, ['home_team', 'visiting_team', 'type', 'time', 'result']]\n",
    "historical_group['result'] = historical_group['result'].str.replace(':', '-')\n",
    "historical_group['team_name'] = historical_group['home_team']\n",
    "historical_group1 = pd.DataFrame(historical_group.values, columns=['home_team', 'visiting_team', 'type', 'time', 'result', 'team_name'])\n",
    "historical_group['team_name'] = historical_group['visiting_team']\n",
    "historical_group2 = pd.DataFrame(historical_group.values, columns=['home_team', 'visiting_team', 'type', 'time', 'result', 'team_name'])\n",
    "\n",
    "historical_record_group = pd.concat([historical_group1, historical_group2, historical_record])\n",
    "\n",
    "historical_record_group.to_csv(r\"D:\\worldcup\\historical_record_group.csv\", index=False)\n",
    "historical_record_group.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import datetime\n",
    "import numpy as np\n",
    "from sklearn.linear_model import LinearRegression\n",
    "\n",
    "alg = LinearRegression()\n",
    "alg.fit(np.array(result_all['净胜球']).reshape(-1, 1), np.array(result_all['真实净胜球']).reshape(-1, 1))\n",
    "\n",
    "def sigmoid(inX):  \n",
    "    return 1.0/(1+np.exp(-inX))  \n",
    "\n",
    "def goal_fiff(team1, team2, competition_time):\n",
    "    #historical_record = pd.read_csv(r\"D:\\worldcup\\historical_record.csv\")\n",
    "    historical_record = pd.read_csv(r\"D:\\worldcup\\historical_record.csv\")\n",
    "    del historical_record['id']\n",
    "    del historical_record['create_time']\n",
    "    del historical_record['update_time']\n",
    "    #去重\n",
    "    historical_record = historical_record.drop_duplicates().reset_index(drop = True)\n",
    "    #处理result为净胜球    \n",
    "    for i in range(len(historical_record)):\n",
    "        num1 = historical_record.loc[i, 'result'].split('-')[0]\n",
    "        num2 = historical_record.loc[i, 'result'].split('-')[1]\n",
    "        if historical_record.loc[i, 'home_team'] == historical_record.loc[i, 'team_name']:\n",
    "            historical_record.loc[i, 'result'] = int(num1) - int(num2)\n",
    "        else:\n",
    "            historical_record.loc[i, 'result'] = int(num2) - int(num1)\n",
    "    #选出team1和team2\n",
    "    historical_record_1 = historical_record.loc[historical_record[\"team_name\"] == team1]\n",
    "    historical_record_2 = historical_record.loc[historical_record[\"team_name\"] == team2]\n",
    "    e_df = set(historical_record_1['home_team'].tolist()).union(set(historical_record_1['visiting_team'].tolist()))\n",
    "    s_df = set(historical_record_2['home_team'].tolist()).union(set(historical_record_2['visiting_team'].tolist()))\n",
    "    e_union_s = e_df.intersection(s_df)\n",
    "    #print(e_union_s)\n",
    "    #选出即和team1交手又和team2交手的队伍\n",
    "    int_inf_2 = historical_record_2.loc[historical_record_2[\"visiting_team\"].isin(e_union_s) | historical_record_2[\"home_team\"].isin(e_union_s)]\n",
    "    int_inf_1 = historical_record_1.loc[historical_record_1[\"visiting_team\"].isin(e_union_s) | historical_record_1[\"home_team\"].isin(e_union_s)]\n",
    "    concat_e_s = pd.concat([int_inf_1, int_inf_2]).reset_index(drop=True)  \n",
    "    \n",
    "    #print(e_df)\n",
    "    #设置比赛开始时间\n",
    "    concat_e_s_sle = concat_e_s.loc[: , ['team_name', 'home_team', 'visiting_team', 'time', 'result', 'score']]\n",
    "    concat_e_s_sle['time'] = pd.to_datetime(concat_e_s_sle['time'])\n",
    "    start_date_str = competition_time\n",
    "    start_date = datetime.datetime.strptime(start_date_str, '%Y/%m/%d %H:%M')\n",
    "    #sigmode处理时间，得出权重\n",
    "    concat_e_s_sle['sec_from_start_to_data'] = (concat_e_s_sle.loc[:, 'time']-start_date).dt.total_seconds()  \n",
    "    concat_e_s_sle['sfstd_non'] = concat_e_s_sle.loc[:, ['sec_from_start_to_data']].apply(lambda x: (x - np.mean(x)) / (np.std(x)))\n",
    "\n",
    "    concat_e_s_sle['wight'] = sigmoid(concat_e_s_sle['sfstd_non'])\n",
    "    #净胜球与权重结合\n",
    "    concat_e_s_sle['result_wight'] = concat_e_s_sle['result'] * concat_e_s_sle['wight']\n",
    "    #计算结合平均值\n",
    "    union_1 = pd.DataFrame({'team_name':[],'oppose_team':[],'mean_result_1':[]})\n",
    "    union_2 = pd.DataFrame({'team_name':[],'oppose_team':[],'mean_result_2':[]})\n",
    "    for i in e_union_s:\n",
    "        if i != team1:\n",
    "            mean_1 = concat_e_s_sle.loc[(concat_e_s_sle['team_name'] == team1)&((concat_e_s_sle['home_team'] == i) | (concat_e_s_sle['visiting_team'] == i))].loc[:, 'result_wight'].mean()\n",
    "            union_1 = pd.concat([union_1, pd.DataFrame({'team_name':[team1],'oppose_team':[i],'mean_result_1':[mean_1]})])\n",
    "        if i != team2:\n",
    "            mean_2 = concat_e_s_sle.loc[(concat_e_s_sle['team_name'] == team2)&((concat_e_s_sle['home_team'] == i) | (concat_e_s_sle['visiting_team'] == i))].loc[:, 'result_wight'].mean()\n",
    "            union_2 = pd.concat([union_2, pd.DataFrame({'team_name':[team2],'oppose_team':[i],'mean_result_2':[mean_2]})])\n",
    "        \n",
    "        \n",
    "    union = union_1.merge(union_2, on = 'oppose_team')\n",
    "    #print(union)\n",
    "    \n",
    "    #team1与team2直接对抗结果\n",
    "    mean_1_2 = concat_e_s_sle.loc[(concat_e_s_sle['team_name'] == team1)&((concat_e_s_sle['home_team'] == team2) | (concat_e_s_sle['visiting_team'] == team2))].loc[:, 'result_wight'].mean()\n",
    "    op_1_2 = pd.DataFrame({'team_name':[team1],'oppose_team':[team2],'mean_result_1':[mean_1_2]})\n",
    "    mean_2_1 = concat_e_s_sle.loc[(concat_e_s_sle['team_name'] == team2)&((concat_e_s_sle['home_team'] == team1) | (concat_e_s_sle['visiting_team'] == team1))].loc[:, 'result_wight'].mean()\n",
    "    op_2_1 = pd.DataFrame({'team_name':[team2],'oppose_team':[team1],'mean_result_2':[mean_2_1]})\n",
    "    #合并所有\n",
    "    union_all = pd.concat([union, op_2_1, op_1_2]).fillna(0)\n",
    "    #print(pd.concat([union, op_2_1, op_1_2]).fillna(0))\n",
    "    \n",
    "    res = (union_all['mean_result_1'] - union_all['mean_result_2']).mean()\n",
    "    #修改\n",
    "    res = alg.predict(np.array(res).reshape(-1, 1))[0,0]\n",
    "    res_e_s = pd.DataFrame({'team1':[team1], 'team2':[team2], 'competition_time':[competition_time], '净胜球':[res]})\n",
    "    return res_e_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>competition_time</th>\n",
       "      <th>team1</th>\n",
       "      <th>team2</th>\n",
       "      <th>净胜球</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/6/30 22:00</td>\n",
       "      <td>法国</td>\n",
       "      <td>阿根廷</td>\n",
       "      <td>0.768492</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/1 2:00</td>\n",
       "      <td>乌拉圭</td>\n",
       "      <td>葡萄牙</td>\n",
       "      <td>-0.896691</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/1 22:00</td>\n",
       "      <td>西班牙</td>\n",
       "      <td>俄罗斯</td>\n",
       "      <td>1.288980</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/2 2:00</td>\n",
       "      <td>克罗地亚</td>\n",
       "      <td>丹麦</td>\n",
       "      <td>-0.152513</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/2 22:00</td>\n",
       "      <td>巴西</td>\n",
       "      <td>墨西哥</td>\n",
       "      <td>0.936298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/3 2:00</td>\n",
       "      <td>比利时</td>\n",
       "      <td>日本</td>\n",
       "      <td>1.118675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/3 22:00</td>\n",
       "      <td>瑞典</td>\n",
       "      <td>瑞士</td>\n",
       "      <td>0.349407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2018/7/4 2:00</td>\n",
       "      <td>哥伦比亚</td>\n",
       "      <td>英格兰</td>\n",
       "      <td>0.096202</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  competition_time team1 team2       净胜球\n",
       "0  2018/6/30 22:00    法国   阿根廷  0.768492\n",
       "0    2018/7/1 2:00   乌拉圭   葡萄牙 -0.896691\n",
       "0   2018/7/1 22:00   西班牙   俄罗斯  1.288980\n",
       "0    2018/7/2 2:00  克罗地亚    丹麦 -0.152513\n",
       "0   2018/7/2 22:00    巴西   墨西哥  0.936298\n",
       "0    2018/7/3 2:00   比利时    日本  1.118675\n",
       "0   2018/7/3 22:00    瑞典    瑞士  0.349407\n",
       "0    2018/7/4 2:00  哥伦比亚   英格兰  0.096202"
      ]
     },
     "execution_count": 105,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "competition_process = pd.read_csv(r\"D:\\worldcup\\competition_process_8.csv\", encoding='gbk', names =['competition_time','team'])\n",
    "competition_process['team1'] = [x.replace('?','').split('-')[0].strip() for x in competition_process['team']]\n",
    "competition_process['team2'] = [x.replace('?','').split('-')[1].strip() for x in competition_process['team']]\n",
    "del competition_process['team']\n",
    "\n",
    "result = pd.DataFrame({'team1':[] , 'team2':[], 'competition_time':[], '净胜球':[]})\n",
    "for i in range(len(competition_process)):\n",
    "    result = pd.concat([result, goal_fiff(competition_process.loc[i, 'team1'], competition_process.loc[i, 'team2'], competition_process.loc[i, 'competition_time'])])\n",
    "    #print(i)\n",
    "result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
